#ifndef COMMON_HPP
#define COMMON_HPP

#ifdef WIN32
#pragma warning(disable: 4995)
#include <windows.h>
#include <mdshow.hpp>
typedef wchar_t char_t;
#define CPCAP_VideoPropertyBrightness VideoProcAmp_Brightness
#define CPCAP_VideoPropertyContrast   VideoProcAmp_Contrast
#define CPCAP_VideoPropertyHue        VideoProcAmp_Hue
#define CPCAP_VideoPropertySharpness  VideoProcAmp_Sharpness
#define CPCAP_VideoPropertySaturation VideoProcAmp_Saturation
#define CPCAP_VideoPropertyGamma      VideoProcAmp_Gamma
#define CPCAP_VideoPropertyGain       VideoProcAmp_Gain
#define CPCAP_VideoPropertyExposure  (VideoProcAmpProperty)(VideoProcAmp_Gamma | VideoProcAmp_Gain)
#endif

#ifdef LINUX
#define GCHART char
#include <linux/videodev2.h>
#define CPCAP_VideoPropertyBrightness V4L2_CID_BRIGHTNESS
#define CPCAP_VideoPropertyContrast   V4L2_CID_CONTRAST
#define CPCAP_VideoPropertyHue        V4L2_CID_HUE
#define CPCAP_VideoPropertySharpness  V4L2_CID_SHARPNESS
#define CPCAP_VideoPropertySaturation V4L2_CID_SATURATION
#define CPCAP_VideoPropertyGamma      V4L2_CID_GAMMA
#define CPCAP_VideoPropertyGain       V4L2_CID_GAIN
#define CPCAP_VideoPropertyExposure   V4L2_CID_EXPOSURE
#define S_OK                       0

typedef int    VideoProcAmpProperty;
typedef char   char_t;
typedef struct _buffer_t {
    void *data;
    int  length;
} buffer_t;

struct PhysicalInput {
    int  index;
    __u8 name[32];
    int  count;
};
#endif

/* Libreria Standard */
#include <stdio.h>
#include <math.h>
#include <string.h>

enum _flip_direction_t {
    FLIP_DIRECTION_HORIZONTAL = 0,
    FLIP_DIRECTION_VERTICAL
};


enum {
    OK_STATUS = 0,
    NO_DEVICES_FOUND,
    CO_INITIALIZATION_FAILED
};

#ifndef M_PI
#define M_PI 3.141592654f
#endif

#define M_2PI 6.283185308f
typedef enum _flip_direction_t flip_direction_t;

#ifdef WIN32
#define GCHART TCHAR
HRESULT find_crossbar_pin(IAMCrossbar *pXBar, int pType, PIN_DIRECTION Dir, long *pIndex);
HRESULT route_crossbar(IAMCrossbar *pXBar, int pType);
#endif
#endif // COMMON_HPP

GCHART *mstrdup(const char *str);
